package CharacterCounter;

import java.util.Scanner;

public class CharacterCounter {
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入一个字符串：");
        String input = sc.nextLine();

        int uppercaseCount = 0;
        int lowercaseCount = 0;
        int digitCount = 0;
        int otherCount = 0;

        for(char c : input.toCharArray())
        {
            if(Character.isUpperCase(c))
            {
                uppercaseCount++;
            }
            else if(Character.isLowerCase(c))
            {
                lowercaseCount++;
            }
            else if(Character.isDigit(c))
            {
                digitCount++;
            }
            else
            {
                otherCount++;
            }
        }
        System.out.println("大写字母个数为："+uppercaseCount);
        System.out.println("小写字母个数为："+lowercaseCount);
        System.out.println("数字个数为："+digitCount);
        System.out.println("其他字符个数为："+otherCount);

        sc.close();
    }
}
